/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Frame_Main.java
 *
 * Created on 4/Dez/2009, 10:38:53
 */

package agents;

import java.awt.Color;
import java.awt.Dimension;

import javax.swing.SwingUtilities;

import problems.AircraftProblem;
import problems.CrewProblem;
import problems.Event;
import problems.PaxProblem;
import problems.Problem;
import problems.Warning;

/**
 *
 * @author pedro
 */
public class Main_Frame extends javax.swing.JFrame {

	int v_size=15;
    /** Creates new form Frame_Main */
    public Main_Frame () {
    	
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    public void addWarning_Panel(Warning w)
    {
    	Painel_prob pp=null;
    	pp = new Painel_prob(w.getType() , w.getDescription() , w.getMinutesDelay());
    	painel_voos.add(pp);
    	pp.setBackground(Color.yellow);
    	pp.setSize(840, 40);
    	pp.setPreferredSize(new Dimension(840,40));
    	pp.setVisible(true);
    	pp.setLocation(3,v_size);
    
    	v_size+=40;
    	SwingUtilities.updateComponentTreeUI(painel_voos);
    	
    }
    
    public void addPaxProblem(PaxProblem p)
    {
    	Painel_prob pp=null;
    	pp = new Painel_prob("Passanger" , p.getDescription() , p.getMinutesDelay());
    	painel_voos.add(pp);
    	pp.setBackground(Color.red);
    	pp.setSize(840, 40);
    	pp.setPreferredSize(new Dimension(840,40));
    	pp.setVisible(true);
    	pp.setLocation(3,v_size);
    	v_size+=40;
    	SwingUtilities.updateComponentTreeUI(painel_voos);
    }
    
    public void addCrewProblem(CrewProblem p)
    {
    	Painel_prob pp=null;
    	pp = new Painel_prob("Crew" , p.getDescription() , p.getMinutesDelay());
    	painel_voos.add(pp);
    	pp.setBackground(Color.red);
    	pp.setSize(840, 40);
    	pp.setPreferredSize(new Dimension(840,40));
    	pp.setVisible(true);
    	pp.setLocation(3,v_size);
    	v_size+=40;
    	SwingUtilities.updateComponentTreeUI(painel_voos);
    	
    }
    public void addProblem_Panel(AircraftProblem p)
    {
       	Painel_prob pp=null;
    	pp = new Painel_prob("aircraft" , p.getDescription() , p.getMinutesDelay());
    	painel_voos.add(pp);
    	pp.setBackground(Color.red);
    	pp.setSize(840, 40);
    	pp.setPreferredSize(new Dimension(840,40));
    	pp.setVisible(true);
    	pp.setLocation(3,v_size);
    	v_size+=40;
    	SwingUtilities.updateComponentTreeUI(painel_voos);

    	
    	
    	
    }
    
    private void initComponents() {

        desc = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        voo = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        crew_memb = new javax.swing.JLabel();
        jSeparator4 = new javax.swing.JSeparator();
        delay = new javax.swing.JLabel();
        jSeparator3 = new javax.swing.JSeparator();
        type = new javax.swing.JLabel();
        painel_voos = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        desc.setForeground(javax.swing.UIManager.getDefaults().getColor("Button.shadow"));
        desc.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        desc.setText("Reason");
        desc.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        voo.setForeground(javax.swing.UIManager.getDefaults().getColor("Button.shadow"));
        voo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        voo.setText("Flight");
        voo.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        crew_memb.setForeground(javax.swing.UIManager.getDefaults().getColor("Button.shadow"));
        crew_memb.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        crew_memb.setText("Crew");
        crew_memb.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        delay.setForeground(javax.swing.UIManager.getDefaults().getColor("Button.shadow"));
        delay.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        delay.setText("Delay");
        delay.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        type.setForeground(javax.swing.UIManager.getDefaults().getColor("Button.shadow"));
        type.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        type.setText("Type");
        type.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        painel_voos.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Reports", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("DejaVu Sans", 0, 13), new java.awt.Color(127, 9, 9))); // NOI18N
        painel_voos.setForeground(new java.awt.Color(106, 14, 14));

        javax.swing.GroupLayout painel_voosLayout = new javax.swing.GroupLayout(painel_voos);
        painel_voos.setLayout(painel_voosLayout);
        painel_voosLayout.setHorizontalGroup(
            painel_voosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 853, Short.MAX_VALUE)
        );
        painel_voosLayout.setVerticalGroup(
            painel_voosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 126, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(voo, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(crew_memb, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(desc, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(type, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(delay, javax.swing.GroupLayout.DEFAULT_SIZE, 94, Short.MAX_VALUE)
                .addGap(28, 28, 28))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(6, 6, 6)
                    .addComponent(painel_voos, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGap(6, 6, 6)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(voo, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(crew_memb)
                        .addComponent(desc)
                        .addComponent(type)
                        .addComponent(delay))
                    .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(217, Short.MAX_VALUE))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(73, 73, 73)
                    .addComponent(painel_voos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(26, Short.MAX_VALUE)))
        );

       
    }// </editor-fold>

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Main_Frame ().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify
    private javax.swing.JLabel crew_memb;
    private javax.swing.JLabel delay;
    private javax.swing.JLabel desc;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JPanel painel_voos;
    private javax.swing.JLabel type;
    private javax.swing.JLabel voo;
    // End of variables declaration

}
